<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>复习</title>
  </head>
  <body></body>
  <script>
    
    var url1 = 'https://www.sina.cn.com'
    var url2 = 'http://www.aa.com'

    var reg1 = /^https?:\/\/\w+\.\w+\.\w+$/
    var reg2 = /^https?:\/\/(\w+\.)*(\w+)(\.\w+)+$/


    /*
    var arr = [url1, url2];

    arr.map(url =>  {
      console.log(url.match(reg1))
      console.log(url.match(reg2))
      console.log('-----------------------\n')
    })
    */
    
    var regs = [reg1, reg2]
    regs.forEach(reg => {
       console.log(url1.match(reg))
       console.log(url2.match(reg))
       console.log('-----------------------\n')
    })


    
  </script>
</html>
